import React from "react";
import "./App.scss";
import { AuthRoute } from "./components/AuthRoute";
import {
  BrowserRouter as Router,
  Route,
  Switch,
  Redirect,
} from "react-router-dom";
import Login from "./pages/Login";
import Layout from "./pages/Layout";
// import { customHistory } from './utils/history';
import ProfileEdit from "./pages/Profile/Edit";
import Article from "./pages/Article";
import Search from "./pages/Search";
import SearchResult from "./pages/Search/SearchResult";
function App() {
  return (
    <Router>
      <div className="app">
        <Switch>
          <Route exact path="/" render={() => <Redirect to="/login" />} />;
          <Route path="/login" component={Login}></Route>
          <Route path="/home" component={Layout}></Route>
          <AuthRoute path="/profile/edit">
            <ProfileEdit />
          </AuthRoute>
          <Route path="/article" component={Article}>
            {/* <Article /> */}
          </Route>
          <Route exact path="/search">
            <Search />
          </Route>
          <Route exact path="/search/result">
            <SearchResult />
          </Route>
        </Switch>
      </div>
    </Router>
  );
}

export default App;
